﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once

#include "GbmpDefines.h"
#include <string>
#include "GmInplaceEdit.h"
#include "GmCommunicationEventTypes.h"

namespace gcmp
{
    class GM_INPLACE_EDIT_EXPORT ICommunicationProtocolHeader
    {
    public:
        virtual ~ICommunicationProtocolHeader() {}

        static OwnerPtr<ICommunicationProtocolHeader> Create();
        //获取版本号
        virtual const std::wstring& GetVersion() const = 0;
        virtual bool SetVersion(const std::wstring& version) = 0;

        //获取功能类型
        virtual FunctionType GetFunctionType() const = 0;
        virtual bool SetFunctionType(FunctionType fType) = 0;

        //获取操作类型
        virtual OperationType GetOperationType() const = 0;
        virtual bool SetOperationType(OperationType oType) = 0;

        //获取是否存在数据
        virtual bool HasData() const = 0;
        virtual bool SetHasData(bool hasData) = 0;
    };

    class CommunicationProtocolHeader : public ICommunicationProtocolHeader
    {
    public:
        virtual ~CommunicationProtocolHeader() {}
        CommunicationProtocolHeader(); 

        //获取版本号
        virtual const std::wstring& GetVersion() const override;
        virtual bool SetVersion(const std::wstring& version) override;

        //获取功能类型
        virtual FunctionType GetFunctionType() const override;
        virtual bool SetFunctionType(FunctionType fType) override;

        //获取操作类型
        virtual OperationType GetOperationType() const override;
        virtual bool SetOperationType(OperationType oType) override;

        //获取是否存在数据
        virtual bool HasData() const override;
        virtual bool SetHasData(bool hasData) override;
    private:
        std::wstring m_version;
        FunctionType m_functionType;
        OperationType m_operationType;
        bool m_hasData;
    };
}
